package com.lancoo.ccas53.service;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.IService;
import com.lancoo.ccas53.entity.*;
import com.lancoo.ccas53.pojo.common.PageInfo;
import com.lancoo.ccas53.pojo.dto.SubGroupDto;
import com.lancoo.ccas53.pojo.vo.AddSubClassVo;
import com.lancoo.ccas53.pojo.vo.SubCourseVo;
import org.springframework.web.multipart.MultipartFile;

import javax.servlet.http.HttpServletResponse;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;

/**
 * <p>
 * 分组上课 服务类
 * </p>
 *
 * @author quin.song
 * @since 2024-05-20
 */
public interface SubClassService extends IService<SubClass> {

    /**
     * 获取分组课程教学班
     *
     * @param uniqueShiftSign
     * @return
     */
    List<SubCourseVo> getByUniqueShiftSign(String uniqueShiftSign);

    /**
     * 分组上课列表
     *
     * @param page
     * @param taskId
     * @param keyword
     * @param baseCollegeId
     * @return
     */
    PageInfo<SubClass> getSubClassList(Page<SubClass> page, Integer taskId, String keyword, String baseCollegeId);

    /**
     * 确认教学任务-上课分组列表
     *
     * @param page
     * @param taskId
     * @param keyword
     * @param baseCollegeId
     * @return
     */
    PageInfo<SubClass> getSubTeachingClassHourList(Page<SubClass> page, Integer taskId, String keyword, String baseCollegeId);


    /**
     * 将教学班拆成单个排课单元
     *
     * @param teachingClasses
     * @return
     */
    List<SubClassGroup> convertSubClassGroup(List<TeachingClass> teachingClasses);

    /**
     * 获取指定年级对应的行政班列表
     *
     * @param taskId
     * @param collegeId
     * @param gradeId
     * @return
     */
    List<Map<String, Object>> phyClassList(Integer taskId, String collegeId, String gradeId);

    /**
     * 添加/更新指定课程对应的行政班列表-分组
     *
     * @param taskId
     * @return
     */
    List<TeachingClass> updatePhyClassList(Integer taskId, String classId, String uniqueShiftSign, List<Long> courseIds);

    /**
     * 获取分组教学班
     *
     * @param uniqueShiftSign
     * @return
     */
    List<TeachingClass> getSubTeachingClass(String uniqueShiftSign);

    /**
     * 根据分组班级获取分组课程
     *
     * @param taskId
     * @param classId
     * @return
     */
    List<Course> getGroupCourse(Integer taskId, String classId);

    /**
     * 添加上课组
     *
     * @param taskId
     * @param param
     * @return
     */
//    List<SubClassGroup> addClassGroup(Integer taskId, List<SubClassGroup> param);

    /**
     * 删除上课组
     *
     * @param taskId
     * @param uniqueShiftSign
     * @return
     */
    Boolean removeClassGroup(Integer taskId, String uniqueShiftSign);

    /**
     * 删除分组
     *
     * @param uniqueShiftSigns
     * @return
     */
    Boolean removeSubClass(List<String> uniqueShiftSigns);

    /**
     * 添加分组
     *
     * @param addSubClassVo
     * @return
     */
    Boolean addSubClass(AddSubClassVo addSubClassVo);

    /**
     * 自动生成分组
     *
     * @param teachingClasses
     * @return
     */
    LinkedList<SubClassGroup> splitClassGroup(List<TeachingClass> teachingClasses);

    /**
     * 删除分组教学班
     *
     * @param taskId
     * @param uuid
     * @return
     */
//    Boolean deleteGroup(Integer taskId, Long uuid);

    /**
     * 获取分组单班、双班列表，分组列表
     *
     * @param taskId
     * @param uuid
     * @return
     */
    SubGroupDto groupOddEvenGroup(Integer taskId, String uuid);

    /**
     * 创建手动分组
     *
     * @param taskId
     * @param uuid
     * @return
     */
    String creatManualGroup(Integer taskId, String uuid);

    /**
     * 单双教学班添加至课程分组列表
     *
     * @param taskId
     * @param ids
     * @return
     */
    Boolean addGroupToCourse(Integer taskId, String subId, List<Integer> ids);

    /**
     * 课程分组列表分解至单、双班
     *
     * @param taskId
     * @param uuid
     * @return
     */
    Boolean recoveryCourseGroup(Integer taskId, String uuid, List<Integer> ids);

    /**
     * 设置分组课程教师
     *
     * @param taskId
     * @param uuid
     * @param courseId
     * @param teacherList
     * @return
     */
    List<TeachingClassTeacher> groupClassTeacher(Integer taskId, String uuid, Long courseId, List<Teacher> teacherList);

    /**
     * 设置分组课程参数
     *
     * @param uuid
     * @param courseId
     * @param roomId
     * @param roomType
     * @return
     */
    List<TeachingClassWeek> groupClassWeek(String uuid, Long courseId, Long roomId, Integer roomType);

    /**
     * 删除分组课程
     *
     * @param taskId
     * @param uuid
     * @return
     */
    Boolean deleteGroupClassCourse(Integer taskId, String uuid);

    void importConfirmTeachingTask(HttpServletResponse response, Integer taskId, Integer flag, MultipartFile file);

    void importGroupClass(HttpServletResponse response, Integer taskId, Integer flag, MultipartFile file);
}
